<?php
    //'active'=> ($this->uri->segment(2)=="registrar" || $this->uri->segment(2)=="modificar" || $this->uri->segment(2)=="eliminar"))
    $sideItems =
        array(
            array(
                'label' => 'Inicio',
                'link' => base_url().'home/principal',
                'icon'=>'chevron-right',
                'active'=> ($this->uri->segment(2)=="principal"),
                'subarbol'=>array()
                ),
            array(
                'label' => 'Cargar Datos',
                'link' => base_url().'',
                'icon'=>'chevron-right',
                'active'=> ($this->uri->segment(2)=="a"),
                'subarbol'=>array(
                                array(
                                    'label' => 'Ciclo Académico',
                                    'link' => base_url().'home/principal',
                                    'icon'=>'minus',
                                    'active'=> ($this->uri->segment(2)=="a")
                                    ),
                                array(
                                    'label' => 'Cursos y Horarios',
                                    'link' => base_url().'home/principal',
                                    'icon'=>'minus',
                                    'active'=> ($this->uri->segment(2)=="a")
                                    ),
                                array(
                                    'label' => 'Docentes',
                                    'link' => base_url().'home/principal',
                                    'icon'=>'minus',
                                    'active'=> ($this->uri->segment(2)=="a")
                                    ),
                                array(
                                    'label' => 'Alumnos',
                                    'link' => base_url().'home/principal',
                                    'icon'=>'minus',
                                    'active'=> ($this->uri->segment(2)=="a")
                                    ),
                                array(
                                    'label' => 'Asistentes de Docencia',
                                    'link' => base_url().'home/principal',
                                    'icon'=>'minus',
                                    'active'=> ($this->uri->segment(2)=="a")
                                    )
                                )
                ),
            array(
                'label' => 'Ciclo Académico',
                'link' => base_url().'home/principal',
                'icon'=>'chevron-right',
                'active'=> ($this->uri->segment(2)=="a"),
                'subarbol'=>array(
                                array(
                                    'label' => 'Cursos y Horarios',
                                    'link' => base_url().'home/principal',
                                    'icon'=>'minus',
                                    'active'=> ($this->uri->segment(2)=="a")
                                    ),
                                array(
                                    'label' => 'Docentes',
                                    'link' => base_url().'home/principal',
                                    'icon'=>'minus',
                                    'active'=> ($this->uri->segment(2)=="a")
                                    ),
                                array(
                                    'label' => 'Alumnos',
                                    'link' => base_url().'home/principal',
                                    'icon'=>'minus',
                                    'active'=> ($this->uri->segment(2)=="a")
                                    ),
                                array(
                                    'label' => 'Asistentes de Docencia',
                                    'link' => base_url().'home/principal',
                                    'icon'=>'minus',
                                    'active'=> ($this->uri->segment(2)=="a")
                                    )
                                )
                ),
            array(
                'label' => 'Perfiles',
                'link' => base_url().'',
                'icon'=>'chevron-right',
                'active'=> ($this->uri->segment(2)=="a"),
                'subarbol'=>array()
                ),
            array(
                'label' => 'Accesos',
                'link' => base_url().'',
                'icon'=>'chevron-right',
                'active'=> ($this->uri->segment(2)=="a"),
                'subarbol'=>array()
                ),
            array(
                'label' => 'Calendario Académico',
                'link' => base_url().'',
                'icon'=>'chevron-right',
                'active'=> ($this->uri->segment(2)=="a"),
                'subarbol'=>array()
                ),
            array(
                'label' => 'Rúbricas',
                'link' => base_url().'',
                'icon'=>'chevron-right',
                'active'=> ($this->uri->segment(2)=="a"),
                'subarbol'=>array(
                                array(
                                    'label' => 'Cargar Datos Iniciales',
                                    'link' => base_url().'home/principal',
                                    'icon'=>'minus',
                                    'active'=> ($this->uri->segment(2)=="a")
                                    ),
                                array(
                                    'label' => 'Crear Rúbrica',
                                    'link' => base_url().'home/principal',
                                    'icon'=>'minus',
                                    'active'=> ($this->uri->segment(2)=="a")
                                    )
                                )
                ),
            array(//DOCENTE
                'label' => 'Cursos',
                'link' => base_url().'',
                'icon'=>'chevron-right',
                'active'=> ($this->uri->segment(2)=="a"),
                'subarbol'=>array(
                                array(
                                    'label' => 'Cursos del Docente',
                                    'link' => base_url().'home/principal',
                                    'icon'=>'minus',
                                    'active'=> ($this->uri->segment(2)=="a")
                                    ),
                                array(
                                    'label' => 'Alumnos',
                                    'link' => base_url().'home/principal',
                                    'icon'=>'minus',
                                    'active'=> ($this->uri->segment(2)=="a")
                                    ),
                                array(
                                    'label' => 'Equipos',
                                    'link' => base_url().'home/principal',
                                    'icon'=>'minus',
                                    'active'=> ($this->uri->segment(2)=="a")
                                    ),
                                array(
                                    'label' => 'Asistentes de Docencia',
                                    'link' => base_url().'home/principal',
                                    'icon'=>'minus',
                                    'active'=> ($this->uri->segment(2)=="a")
                                    ),
                                array(
                                    'label' => 'Evaluaciones',
                                    'link' => base_url().'home/principal',
                                    'icon'=>'minus',
                                    'active'=> ($this->uri->segment(2)=="a")
                                    ),
                                array(
                                    'label' => 'Indicadores',
                                    'link' => base_url().'home/principal',
                                    'icon'=>'minus',
                                    'active'=> ($this->uri->segment(2)=="a")
                                    )
                                )
                ),
            array(//ASISTENTE DE DOCENCIA
                'label' => 'Cursos',
                'link' => base_url().'',
                'icon'=>'chevron-right',
                'active'=> ($this->uri->segment(2)=="a"),
                'subarbol'=>array(
                                array(
                                    'label' => 'Cursos del Asistente de Docencia',
                                    'link' => base_url().'home/principal',
                                    'icon'=>'minus',
                                    'active'=> ($this->uri->segment(2)=="a")
                                    ),
                                array(
                                    'label' => 'Alumnos',
                                    'link' => base_url().'home/principal',
                                    'icon'=>'minus',
                                    'active'=> ($this->uri->segment(2)=="a")
                                    ),
                                array(
                                    'label' => 'Equipos',
                                    'link' => base_url().'home/principal',
                                    'icon'=>'minus',
                                    'active'=> ($this->uri->segment(2)=="a")
                                    ),
                                array(
                                    'label' => 'Evaluaciones',
                                    'link' => base_url().'home/principal',
                                    'icon'=>'minus',
                                    'active'=> ($this->uri->segment(2)=="a")
                                    ),
                                array(
                                    'label' => 'Indicadores',
                                    'link' => base_url().'home/principal',
                                    'icon'=>'minus',
                                    'active'=> ($this->uri->segment(2)=="a")
                                    )
                                )
                ),
            array(//ALUMNO
                'label' => 'Cursos',
                'link' => base_url().'',
                'icon'=>'chevron-right',
                'active'=> ($this->uri->segment(2)=="a"),
                'subarbol'=>array(
                                array(
                                    'label' => 'Cursos del Alumno',
                                    'link' => base_url().'home/principal',
                                    'icon'=>'minus',
                                    'active'=> ($this->uri->segment(2)=="a")
                                    ),
                                array(
                                    'label' => 'Evaluaciones',
                                    'link' => base_url().'home/principal',
                                    'icon'=>'minus',
                                    'active'=> ($this->uri->segment(2)=="a")
                                    ),
                                array(
                                    'label' => 'Indicadores',
                                    'link' => base_url().'home/principal',
                                    'icon'=>'minus',
                                    'active'=> ($this->uri->segment(2)=="a")
                                    )
                                )
                )
            );
?>

<div class="well sidebar-nav">
    <ul class="nav nav-list">
        <?php
            foreach ($sideItems as $arbol){
                $activeStr1 = "";
                if ($arbol['active']) $activeStr1 ="class='active'";
                echo
                    "<li ".$activeStr1.">
                        <a href='".$arbol['link']."'>".
                            '<i class="icon-'.$arbol['icon'].'"></i>'.$arbol['label']."
                        </a>";
//                    echo "<ul hidden='true' class='nav nav-list'>";
                    echo "<ul class='nav nav-list'>";
                    foreach ($arbol['subarbol'] as $subarbol){
                        $activeStr2 = "";
                        if ($subarbol['active']) $activeStr2 ="class='active'";
                        echo
                            "<li ".$activeStr2.">
                                <a href='".$subarbol['link']."'>".
                                    '<i class="icon-'.$subarbol['icon'].'"></i>'.$subarbol['label']."
                                </a>
                            </li>";
                    }
                    echo "</ul>                
                    </li>";
            }
        ?>
    </ul>
</div>